<template>
  <el-dialog :close-on-click-modal="false" :visible.sync="showDialog" :title="title" width="75%">
    <el-form ref="form" :model="form" size="small" label-width="100px">
      <el-row :gutter="10">
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <el-form-item :label="tf('locale')" prop="locale">
            <Dictionary v-model="form.locale" :updata-dict="form.locale" :dict-key="'LOCALE'" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <el-form-item :label="tf('cataType')">
            <Dictionary v-model="form.cataType" :updata-dict="form.cataType" :dict-key="'SYS_CATA_TYPE'" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <el-form-item :label="tf('system')">
            <el-input v-model="form.system" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <el-form-item :label="tf('code')" prop="code">
            <el-input v-model="form.code" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <el-form-item :label="tf('name')" prop="name">
            <el-input v-model="form.name" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <el-form-item :label="tf('remark')" prop="remark">
            <el-input v-model="form.remark" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <el-form-item :label="tf('enabled')" prop="enabled">
            <Dictionary v-model="form.enabled" :updata-dict="form.enabled + ''" :dict-key="'ENABLE_FLAG'" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <el-form-item :label="tf('updateBy')">
            <el-input v-model="form.updateBy" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <el-form-item :label="tf('updateTime')">
            <el-input v-model="form.updateTime" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="close()">{{ $t('btn.close') }}</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { preview } from '@/api/gaeaUiI18n'
import Dictionary from '@/components/Dictionary/index'
import i18nHandler from '@/mixins/i18nHandler'

export default {
  name: 'GaeaUiI18nDetail',
  components: { Dictionary },
  mixins: [i18nHandler],
  props: {
    module: String,
  },
  data() {
    return {
      showDialog: false,
      title: '',
      dictionarys: [],
      form: {},
      i18nQry: {},
    }
  },
  created() {
    this.i18nQry.module = this.module
  },
  methods: {
    close() {
      this.showDialog = false
      this.form = {}
    },

    init() {
      preview({ id: this.form.id, accessKey: this.form.accessKey })
        .then((data) => {
          this.form = data.data
        })
        .catch(() => {})
    },
  },
}
</script>

<style scoped></style>
